import request from '../utils/request'
// 个人信息
const getUserInfoAPI = () => {
  return request({
    method: 'GET',
    url: '/v1_0/user'
  })
}
// 个人资料
const userProfileAPI = () => {
  return request({
    url: '/v1_0/user/profile'
  })
}
// 更换头像
const updatePhotoAPI = (formObj) => {
  return request({
    url: '/v1_0/user/photo',
    method: 'PATCH',
    data: formObj
    // 如果你的请求体内容是表单对象, 浏览器会自动携带请求头Content-Type为multipart/form-data
  })
}
// 更新资料
const updateProfileAPI = ({ birthday, userName }) => {
  return request({
    url: '/v1_0/user/profile',
    method: 'PATCH',
    data: {
      birthday: birthday,
      name: userName
    }
  })
}

// 更新token的接口
const updateTokenAPI = () => {
  return request({
    method: 'PUT',
    url: '/v1_0/authorizations'

  })
}
export {
  getUserInfoAPI,
  userProfileAPI,
  updatePhotoAPI,
  updateProfileAPI,
  updateTokenAPI
}
